# -*- coding: utf-8 -*- 
#!/usr/bin/python2.7
"""渲染器，把template和对应的变量渲染后输入"""

class Renderer:
    def __init__(self):
        pass
    def render(self,absFilePath,dataObject):
        pass

class MakoRenderer(Renderer):
    def __init__(self):
        Renderer.__init__(self)
    def render(self,absFilePath,dataObject):
        from mako.template import Template
        from mako.lookup import TemplateLookup
        
        lookup = TemplateLookup(
                                  directories=['',],input_encoding='utf-8',output_encoding='utf-8',
                                  )
        template = Template(
                                          filename=absFilePath,
                                          input_encoding='utf-8',
                                          output_encoding='utf-8',
                                          lookup=lookup,
                                          )
        return template.render(DATA=dataObject)